<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>用户信息管理</title>
    <!-- 引入 bootstrap的 css -->
    <link type="text/css" rel="stylesheet" th:href="@{plugins/bootstrap-3.4.1-dist/css/bootstrap.min.css}"/>
    <!-- 引入分页插件pagination的css样式文件 -->
    <link type="text/css" rel="stylesheet" th:href="@{plugins/pagination-2.1.5/css/pagination.css}">
    <!-- 引入 jquery 框架，需要第一个引入，因为其他的js会使用该框架 -->
    <script type="text/javascript" th:src="@{plugins/jquery-3.6.0/jquery-3.6.0.min.js}"></script>
    <!-- 引入 bootstrap的js -->
    <script type="text/javascript" th:src="@{plugins/bootstrap-3.4.1-dist/js/bootstrap.min.js}"></script>
    <!-- 引入假分页控件pagination的js -->
    <script type="text/javascript" th:src="@{plugins/pagination-2.1.5/js/pagination.min.js}"></script>
    <!-- 引入自己写的js -->
    <script type="text/javascript" th:src="@{js/backstage/goodsInfoManager.js}"></script>
</head>
<body>
</br>
<div class="row">
    <div class="col-lg-1 ">
        <span class="input-group-btn">
             <button class="btn btn-default" type="button" onclick="queryAllGoods()" style="color: green">&nbsp;显示全部商品</button>
        </span>
    </div>
    <div class="col-lg-4 col-lg-offset-3">
        <div class="input-group">
            <input type="text" id="gname" name="gname" class="form-control" placeholder="请输入搜索内容">
            <span class="input-group-btn">
                <button class="btn btn-default" type="button" onclick="queryGoodsByKey()" style="color: green"><span class="glyphicon glyphicon-search" aria-hidden="true"></span>&nbsp;搜索</button>
            </span>
        </div>
    </div>
<!--    <div class="col-lg-1 col-lg-offset-6" >-->
<!--        <button class="btn btn-default" type="button" style="background-color: red">&nbsp;批量删除</button>-->
<!--    </div>-->

</div><!-- /.row -->
<div style="width: 98%">
    <div class="bs-example table-responsive" data-example-id="hoverable-table">
        <table class="table table-hover text-nowrap" height="200px">
            <thead>
            <tr>
                <!--<th>
                    <input type="checkbox" aria-label="...">
                </th>-->
                <th>序号</th>
                <th>商品名</th>
                <th>生产地</th>
                <th>单价/单位</th>
                <th>库存</th>
                <th>商品图</th>
                <th>规格</th>
                <th>标签</th>
                <th>折扣</th>
                <th>操作</th>
<!--                <th>大分类</th>-->
<!--                <th>二级分类</th>-->
<!--                <th>小分类</th>-->
            </tr>
            </thead>
            <tbody id="showMsg">

            </tbody>
        </table>
        <div id="queryPager"></div>
    </div>
</div>
<!-- ======================修改弹出模态框 modal====================== -->
<div id="goodInfoModal" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="gridSystemModalLabel">
    <div class="modal-dialog" role="document" style="width: 1000px">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span>
                </button>
                <h4 class="modal-title" id="gridSystemModalLabel">商品信息管理</h4>
            </div>
            <div class="modal-body">
                <!-- 这里放置 modal 的表单 start -->
                <div class="ibox-content">
                    <form id="updateForm" action="updateGoodInfo" method="post" class="form-horizontal"
                          enctype="multipart/form-data">
                        <input type="hidden" id="gid" name="gid">
                        <div class="form-group">
                            <label class="col-sm-2 control-label">商品</label>
                            <div class="col-sm-3">
                                <input type="text" id="gname_edit" name="gname" class="form-control">
                                <span class="help-block m-b-none" id="gname-label" style="color: #ff0000"></span>
                            </div>
                            <label class="col-sm-2 control-label">生产地</label>
                            <div class="col-sm-3">
                                <input type="text" id="producer_edit" name="producer" class="form-control">
                                <span class="help-block m-b-none" id="producer-label" style="color: #ff0000"></span>
                            </div>
                        </div>

                        <div class="hr-line-dashed"></div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">价格</label>
                            <div class="col-sm-3">
                                <input type="text" id="price_edit" name="price" class="form-control">
                                <span class="help-block m-b-none" id="price-label" style="color: #ff0000"></span>
                            </div>
                            <label class="col-sm-2 control-label">单位</label>
                            <div class="col-sm-3">
                                <input type="text" id="unit_edit" name="unit" class="form-control">
                                <span class="help-block m-b-none" id="unit-label" style="color: #ff0000"></span>
                            </div>
                        </div>

                        <div class="hr-line-dashed"></div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">库存</label>
                            <div class="col-sm-3">
                                <input type="text" id="inventory_edit" name="inventory" class="form-control">
                                <span class="help-block m-b-none" id="inventory-label" style="color: #ff0000"></span>
                            </div>
                            <label class="col-sm-2 control-label">图片</label>
                            <div class="col-sm-3">
                                <!-- 因为文件要使用 MultipartFile 进行映射，所以不要和实体类的属性名，保持一致 -->
                                <input type="file" id="image_edit" name="file_image" class="form-control">
                                <span class="help-block m-b-none" id="image-label" style="color: #ff0000"></span>
                            </div>
                        </div>

                        <div class="hr-line-dashed"></div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">规格</label>
                            <div class="col-sm-3">
                                <input type="text" id="specification_edit" name="specification" class="form-control">
                                <span class="help-block m-b-none" id="specification-label" style="color: #ff0000"></span>
                            </div>
                            <label class="col-sm-2 control-label">标签</label>
                            <div class="col-sm-3">
                                <input type="text" id="lable_edit" name="lable" class="form-control">
                                <span class="help-block m-b-none" id="label-label" style="color: #ff0000"></span>
                            </div>
                        </div>

                        <div class="hr-line-dashed"></div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">折扣</label>
                            <div class="col-sm-3">
                                <input type="text" id="discount_edit" name="discount" class="form-control">
                                <span class="help-block m-b-none" id="discount-label" style="color: #ff0000"></span>
                            </div>
                        </div>
                    </form>
                </div>
                <!-- 这里放置 modal 的表单 end -->
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                <button id="save" type="button" class="btn btn-primary" onclick="updateGood()">保存</button>
            </div>
        </div><!-- /.modal-content -->
    </div><!-- /.modal-dialog -->
</div><!-- /.modal -->
</body>
</html>